package com.atguigu.campusintelligentassistantsystem.entity;

public enum ScholarshipStatus {
    ACTIVE("active", "有效"),
    INACTIVE("inactive", "无效");

    private final String code;
    private final String description;

    ScholarshipStatus(String code, String description) {
        this.code = code;
        this.description = description;
    }

    public String getCode() {
        return code;
    }

    public String getDescription() {
        return description;
    }

    @Override
    public String toString() {
        return code;
    }

    public static ScholarshipStatus fromCode(String code) {
        for (ScholarshipStatus status : ScholarshipStatus.values()) {
            if (status.getCode().equals(code)) {
                return status;
            }
        }
        throw new IllegalArgumentException("未知的奖学金状态: " + code);
    }
}